package cn.xopencode.recordservice.dal.mysql.mapper.robotroom;

import cn.xopencode.recordservice.dal.mysql.dataobject.robotroom.RobotRoomRecordEmpRelDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RobotRoomRecordEmpRelMapper extends BaseMapper<RobotRoomRecordEmpRelDO> {

    /**
     * 批量插入。因为 MyBaits Plus 的批量插入是基于 Service 实现，所以只好写 XML
     *
     * @param empRelDOList 数组
     */
    int insertList(@Param("empRelDOList") List<RobotRoomRecordEmpRelDO> empRelDOList);

    default List<RobotRoomRecordEmpRelDO> selectListByRecordId(String recordId){
        return selectList((new QueryWrapper<RobotRoomRecordEmpRelDO>().eq("record_id", recordId)));
    }


    default int deleteByRecordId(String recordId){
        return delete(new QueryWrapper<RobotRoomRecordEmpRelDO>().eq("record_id", recordId));
    }
}
